<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <link rel="stylesheet" href="../../static/assets/css/zpui.css" />
    <link rel="stylesheet" href="../../static/assets/css/all.css" />
    <script src="../../static/assets/js/page.js"></script>
    <link rel="stylesheet" href="../../static/mobile/default/css/my.css" />
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>

    <title> 意见反馈 </title>
</head>

<body>
    <div class="page">
        <div class="page-hd">
            <div class="header bor-1px-b">
                <div class="header-left">
                    <a href="javascript:history.go(-1)" class="left-arrow"></a>
                </div>
                <div class="header-title">意见反馈</div>
                <div class="header-right">
                    <a href="#"></a>
                </div>
            </div>
        </div>

        <div class="page-bd">
            <!-- 页面内容-->
            <div class="card-box fs26 fw600" style="color: #2c0f0f;background-color: #f6a395;padding: 0.25rem">
                为了更快的解决您的问题，请在遇到问题时候第一时 间提交反馈，我们将尽快为您解决！
            </div>
            <form id="msg_data">
                <div class="weui-cells weui-cells_checkbox mt0 border-none" style="display: flex;background: transparent;">
                    <label class="weui-cell weui-check__label" for="x1">
                <div class="weui-cell__hd">
                    <input type="radio" class="weui-check" value="0" name="type" id="x1">
                    <span class="weui-icon-checked"></span>
                </div>
                <div class="weui-cell__bd">
                    <p class="fs28 fw600">遇到问题</p>
                </div>
            </label>
                    <label class="weui-cell weui-check__label" for="x2">
                <div class="weui-cell__hd">
                    <input type="radio" name="type" value="1" class="weui-check" id="x2" checked="checked">
                    <span class="weui-icon-checked"></span>
                </div>
                <div class="weui-cell__bd">
                    <p class="fs28 fw600">使用建议</p>
                </div>
            </label>
                </div>
                <div class="weui-cells weui-cells_form card-box">
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <textarea class="weui-textarea" name="content" oninput="contentnum(this)" maxlength="200" placeholder="请详细描述您遇到的问题" rows="6"></textarea>
                            <div class="weui-textarea-counter"><span id="length">0</span>/200</div>

                        </div>
                    </div>
                </div>
                <!-- <div class="weui-cells weui-cells_form card-box">
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <div class="weui-uploader">
                                <div class="weui-uploader__hd">
                                    <p class="weui-uploader__title fs28 fw600">上传照片</p>
                                </div>
                                <div class="weui-uploader__bd">
                                    <ul class="weui-uploader__files" id="uploaderFiles"></ul>
                                    <div class="weui-uploader__input-box" id="picval">
                                        <input id="uploaderInput" class="weui-uploader__input uploadInput" type="file" accept="image/*" multiple="">
                                        <input type="hidden" name="pics[]" value="">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> -->
            </form>
            <div class="weui-btn-area">
                <a href="javascript:;" onclick="enterpost()" class="weui-btn weui-btn_primary">提交</a>
            </div>
        </div>
    </div>

    <script src="../../static/assets/js/lib/jquery-2.1.4.js"></script>
    <script src="../../static/assets/js/jquery-weui.min.js"></script>
    <script src="../../static/assets/js/lib/fastclick.js"></script>

    <script src="../../static/mobile/default/js/uploadsimage.js?v=1"></script>
    <script>
        $(function() {
            FastClick.attach(document.body);
        });
    </script>
    <script>
        var fd = new FormData();
        var li = 0;
        var enter = 0;
        //上传图片
        $('#uploaderInput').click(function() {
            var that = $('#uploaderFiles');
            var html = '';
            _uplocalfunction = function(base64Img) {
                //fd.append("imgfile", base64Img);
                var box = $(that).children('li').length;
                if (box >= 6) {
                    $.alert('最多上传6张图片');
                    return;
                }
                html = '<li class="weui-uploader__file" id="img' + li + '" style="background-image:url(' + base64Img + ')">\
                    <div class="del_btn">\
                        <img src="../../static/assets/images/icon_del.png" data-id="' + li + '" onclick="closeImg(this)" alt="">\
                                        </div>\
                                    </li >';

                $('#uploaderFiles').append(html);

                $('#picval').append('<input type="hidden" id="pics' + li + '" name="pics[]" value="' + base64Img + '">');
                li += 1;
            }
        })

        //计算数字
        function contentnum(obj) {
            var length = $(obj).val().length;
            $('#length').text(length)
        }

        //关闭图片
        function closeImg(obj) {
            var id = $(obj).attr('data-id');
            $('#pics' + id).remove();
            $('#img' + id).remove();
        }

        //确认上传
        function enterpost() {
            if (enter > 0) {
                $.alert('请不要重复提交');
            }
            var data = $('#msg_data').serialize();
            enter = 1;
            $.ajax({
                url: "https://mp.jianguoes.com/api/mp/saveFeedback",
                type: "post",
                dataType: "json",
                data: data,
                success: function(res) {
                    if (res.code == 0) {
                        enter = 0;
                        $.alert(res.errmsg)
                    } else {
                        $.alert(res.errmsg, function() {
                            enter = 0;
                            window.location.reload()
                        })
                    }
                },
                error: function() {
                    enter = 0;
                }
            })
        }
    </script>
</body>

</html>